﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace SceneEditor
{
	public class TestScreenShot : MaskableGraphic {

        Vector2 size;
        protected override void Start()
        {
            base.Start();
            size = rectTransform.rect.size;
        }
        protected override void OnPopulateMesh(VertexHelper vh)
        {
            vh.Clear();
            //添加四个顶点
            //vh.AddVert(new Vector3(-Screen.width/2, -Screen.height/2), Color.red, Vector2.zero);
            //vh.AddVert(new Vector3(-Screen.width / 2, Screen.height / 2), Color.green, Vector2.zero);
            //vh.AddVert(new Vector3(Screen.width / 2, Screen.height / 2), Color.black, Vector2.zero);
            //vh.AddVert(new Vector3(Screen.width / 2, -Screen.height / 2), Color.blue, Vector2.zero);
            vh.AddVert(new Vector3(0, 0), Color.red, Vector2.zero);
            vh.AddVert(new Vector3(0, size.y), Color.green, Vector2.zero);
            vh.AddVert(new Vector3(size.x, size.y ), Color.black, Vector2.zero);
            vh.AddVert(new Vector3(size.x , 0), Color.blue, Vector2.zero);
            //添加两个三角形
            vh.AddTriangle(0, 1, 2);
            vh.AddTriangle(2, 3, 0);

            Debug.Log("currentIndexCount " + vh.currentIndexCount);
            Debug.Log("currentVertCount " + vh.currentVertCount);
        }
    }
}
